﻿using System;
using System.Collections.Generic;
using System.Text;
using IBDM2IBSInterface;
using Models;

namespace TimeTableCreatorOO
{
    public class RowCleaner
    {
        #region Info

        private IList<string> _rowInfo;
        private TokenModel _token;
        private PartModel _part;
        private IStation _beginStation;

        private int _nodePosition;

        public TokenModel Token { get { return _token; } }

        public PartModel Part { get { return _part; } }

        #endregion


        public RowCleaner(IList<string> rowInfo, TokenModel token, IStation beginStation)
        {
            _rowInfo = rowInfo;
            _token = token;
            _beginStation = beginStation;

            #region init

            _stateStart = new StateStart(this);
            _stateShift = new StateShift(this);
            _stateRead = new StateRead(this);
            _stateFind = new StateFind(this);
            _stateFinish = new StateFinish(this);

            _state = _stateStart;

            _isFinish = false;

            #endregion
        }

        #region State

        private IState _stateRead;
        private IState _stateStart;
        private IState _stateFind;
        private IState _stateShift;
        private IState _stateFinish;
        private IState _state;

        public IState State
        {
            get { return _state; }
            set { _state = value; }
        }

        #endregion

        #region GetState

        public IState GetStateRead()
        {
            return this._stateRead;
        }

        public IState GetStateStart()
        {
            return this._stateStart;
        }

        public IState GetStateFind()
        {
            return this._stateFind;
        }

        public IState GetStateShift()
        {
            return this._stateShift;
        }

        public IState GetStateFinish()
        {
            return this._stateFinish;
        }

        #endregion

        public void GotoNextTurn(string content)
        {
            _nodePosition++;
            _state.GotoNextTurn(content);
        }

        internal bool _isFinish;
        public bool IsFinish
        {
            get { return _isFinish; }
        }

        #region Action

        public InputContent GetContentType(string s)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
